<template>
  <div id="app">
    <h1>axios</h1>
    <button @click="getStudent">发送获取student</button>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "App",
  data: function () {
    return {};
  },

  components: {},

  methods: {
    getStudent() {
      axios
        .get("http://localhost:8080/api/demo/students")
        .then((response) => {
          console.log(response.data);
        })
        .catch((error) => {
          console.error("请求失败:", error.message);
        });
    },
  },
};
</script>

<style scoped>
</style>